<template>
  <el-container class="index-con">
    <el-aside :class="showclass">
      <left-nav :collapsed="collapsed"></left-nav>
    </el-aside>
    <el-container class="main-con">
      <el-header class="index-header">
        <nav-con @toggle="toggleEvent"></nav-con>
      </el-header>
      <el-main clss="index-main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
// 导入组件
import navCon from "./components/navcon.vue";
import leftNav from "./components/leftnav.vue";

export default {
  name: "index",
  data() {
    return {
      collapsed: false,
      showclass: "asideshow",
      showtype: false,
    };
  },
  // 注册组件
  components: {
    navCon,
    leftNav,
  },
  methods: {
    toggleEvent: function (e) {
      setTimeout(() => {
        if (e) {
          this.showclass = 'asideshow'
        } else {
          this.showclass = 'aside'
        }
        this.collapsed = !this.collapsed
      }, 300);
    }
  },
  created() {
  },
  beforeUpdate() { },
  // 挂载前状态(里面是操作)
  beforeMount() {
  },
};
</script>
<style >
.index-con {
  height: 100%;
  width: 100%;
  box-sizing: border-box;
}

.aside {
  width: 64px !important;
  height: 100%;
  background-color: #304156;
  margin: 0px;
}

.asideshow {
  width: 200px !important;
  height: 100%;
  background-color: #334157;
  margin: 0px;
}

.index-header,
.index-main {
  padding: 0px;
  border-left: 2px solid #fff;
}
</style>
